﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class UserControl_control_search_tinh_thanh : System.Web.UI.UserControl
{
    const string strClassName = "UserControl_control_search_tinh_thanh";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            xGetData();
        }
    }

    private void xGetData()
    {
        try
        {
            string strKV_ID = "";
            string strKv_Url = clsCommon.fncGetRoute(this.Page, "param1");
            string strKieuPhong = clsCommon.fncGetRoute(this.Page, "userControl");
            if (strKv_Url == basConst.PT_TOAN_QUOC) strKV_ID = "0";
            else
            {
                strKV_ID = clsKhuVuc.fncGet_ID_KhuVucBy_TenKodau(strKv_Url);
            }
            DataTable dt = clsKhuVuc.fncGetKhuVucBy_ParentID(strKV_ID);
            if (dt == null) { return; }
            if (dt.Rows.Count <= 0) { return; }

            string strhtml = "";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                strhtml += "<li><a href='/" + strKieuPhong + "/" + dt.Rows[i]["KV_TENKHONGDAU"].ToString().ToLower() + "' title='" + strKieuPhong + " " + dt.Rows[i]["KV_TEN"].ToString().ToLower() + "'>" + dt.Rows[i]["KV_TEN"].ToString() + "</a></li>";
            }
            ltrLink.Text = strhtml;
        }
        catch (Exception ex)
        {
            OsPortal.oFileHelper.WriteLogErr(strClassName, "xGetData", ex.ToString());
        }
    }
}